
//导入创建store的函数
import { configureStore, combineReducers } from '@reduxjs/toolkit'
//导入Reducer的切片
import ticketReducer from './slice/ticket'

import userReducer from './slice/user'
import { persistStore, persistReducer } from 'redux-persist'
import storage from 'redux-persist/lib/storage'


const persistConfig = {
    key: 'root',
    storage,
}

const persistedReducer = persistReducer(persistConfig, combineReducers({
    ticket: ticketReducer,
    user: userReducer

}))
// let persistor = persistStore(store)
const store = configureStore({
    reducer: 
        //集成所有的slice的切片
        persistedReducer,
        middleware:(m)=>m({serializableCheck:false})
        
    
})
export let persistor = persistStore(store)

export default store